package cn.stylefeng.guns.czlm.mapper;

import cn.stylefeng.guns.czlm.entity.TbAttachment;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface Tb_attachmentMapper extends BaseMapper<TbAttachment> {


    @Select("SELECT id,name,user_id,url,mime_type,suffix,created from tb_attachment ")
      List<TbAttachment> SelectAllImg();

    @Delete("DELETE from tb_attachment where id= #{id}")
    Integer delImg(Integer id);

    @Insert("   INSERT INTO tb_attachment (name,user_id,url,mime_type,suffix,size)\n" +
            "        VALUES (\n" +
            "            #{name},\n" +
            "            #{userId},\n" +
            "            #{url},\n" +
            "            #{mimeType},\n" +
            "            #{suffix},\n" +
            "            #{size}\n" +
            "        ) ")
    Integer saveImg(TbAttachment tbAttachment) ;
}
